<template>
	<view>
		<u-navbar
		        :safeAreaInsetTop="false"
		    >
		        <view
		            class="u-nav-slot"
		            slot="left"
		        >
		          <image src="/static/images/back_three.svg" class="icons" @click="goback"></image>
		        </view>
				<view
				    class="u-nav-slot"
				    slot="center"
				>
				<view class="nav-title">足     迹</view>
				</view>
				<view
				    class="u-nav-slot"
				    slot="right"
				>
				    <image src="/static/images/del_view.svg" class="icons" @click="deleFoot"
				    ></image>
				</view>
		    </u-navbar>
			<view style="position: relative;padding:120rpx 30rpx 140rpx 30rpx">
				<view v-if="list.length>0">
					<view v-for="item,index in list" class="item col" :key="index" >
						<view class="row">
							<image class="book" :src="item.coverPics[0]">
							</image>
							<view class="col" style="margin-left: 20rpx;width: 100%;">
								<view class="book-title">
									{{item.title}}
								</view>
								<view class="book-category">
									#1 {{item.itemTitle}}
								</view>
								<view class="row-end book-time">
									{{item.createTime}}
								</view>
							</view>
						</view>
					
					</view>
				</view>
			
				<view class="col-center no-data" v-else>
					暂无历史记录
				</view>
			</view>
	</view>

</template>

<script>
		import titlebar from '@/pages/common/titlebar.vue'
		import {
			getViews,delViews
		} from '@/api/change/index.js'
	export default {
		components:{
				titlebar
		},
		data() {
			return {
				showManage:false,
				showSearch:false,
				keyword:'',
				list:[],
				page:1
			}
		},
		
		onLoad() {
		
			
		},
		onReady() {
			console.log('2222')
		},
		mounted() {
				console.log('111')
				this.getViews()
		},
		methods: {
			deleFoot(){
				let that = this
				uni.showModal({
					title:'提示',
					content:'确定要删除记录吗？',
					success(res) {
						if(res.confirm){
							let ids = ''
							for(const item of that.list){
								ids = ids+item.id+','
							}
							
							delViews(ids).then(res=>{
								that.list = []
							})
						}
					}
				})
			
			},
			goback(){
				uni.navigateBack()
			},
			getViews(){
				getViews({}).then(res=>{
					if(this.page == 1){
						this.list = []
					}
					this.list = this.list.concat(res.rows) 
				})
			}
		}
	}
</script>

<style scoped lang="scss">
	.icons{
		width: 50rpx;
		height: 50rpx;
	}
	.nav-title{
		color: rgba(16, 16, 16, 1);
		font-size: 40rpx;
		text-align: center;
		font-weight: bolder;
	}
	.no-data{
		height: 80vh;
		color: #9a9a9a;
		font-size: 40rpx;
		font-weight: bold;
	}
	.item{
		padding: 20rpx 30rpx;
		border-radius: 30rpx;
		background-color: rgba(255, 255, 255, 1);
		color: rgba(16, 16, 16, 1);
		margin-bottom: 40rpx;
		.title{
			color: rgba(16, 16, 16, 1);
			font-size: 56rpx;
			font-family: PMZDBiaoTi-regular;
		}
		.star{
			width: 60rpx;
			height: 60rpx;
		}
		.img{
			margin-top: 10rpx;
			background-color: red;
			width: 100%;
			height: 360rpx;
			border-radius: 10px;
		}
		.update{
			color: rgba(16, 16, 16, 1);
			font-size: 32rpx;
		}
		.count{
			color: rgba(16, 16, 16, 1);
			font-size: 36rpx;
		}
		
		.book{
			flex-shrink: 0;
			width: 200rpx;
			height: 240rpx;
			border-radius: 20rpx;
		}
		.book-title{
			color: rgba(0, 0, 0, 1);
			font-size: 40rpx;
		}
		.book-category{
			margin-top: 10rpx;
			color: rgba(0, 0, 0, 1);
			font-size: 40rpx;
			font-weight: bold;
		}
		.book-time{
			margin-top: 80rpx;
			color: rgba(16, 16, 16, 1);
			font-size: 32rpx;
		}
	}
</style>
